/*    */ package com.zimbra.cs.account.ldap.upgrade;
/*    */ 
/*    */ import com.zimbra.common.account.Key.AccountBy;
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.cs.account.Account;
/*    */ import com.zimbra.cs.account.Config;
/*    */ import com.zimbra.cs.account.Entry.EntryType;
/*    */ import com.zimbra.cs.account.ldap.LdapProv;
/*    */ import java.util.Arrays;
/*    */ import java.util.HashMap;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class BUG_72007
/*    */   extends UpgradeOp
/*    */ {
/* 33 */   private static final String[] ATTRS = { "zimbraIsSystemResource", "zimbraIsSystemAccount" };
/*    */   
/*    */ 
/*    */ 
/*    */   void doUpgrade()
/*    */     throws ServiceException
/*    */   {
/* 40 */     Config config = this.prov.getConfig();
/* 41 */     upgrdeAcount(config.getAttr("zimbraSpamIsNotSpamAccount"));
/* 42 */     upgrdeAcount(config.getAttr("zimbraSpamIsSpamAccount"));
/*    */   }
/*    */   
/*    */   Description getDescription()
/*    */   {
/* 47 */     return new Description(this, ATTRS, new Entry.EntryType[] { Entry.EntryType.ACCOUNT }, null, "TRUE", String.format("Set %s of %s and %s accounts to %s", new Object[] { Arrays.deepToString(ATTRS), "zimbraSpamIsNotSpamAccount", "zimbraSpamIsSpamAccount", "TRUE" }));
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   private void upgrdeAcount(String name)
/*    */     throws ServiceException
/*    */   {
/* 60 */     if (name != null) {
/* 61 */       Account acct = this.prov.get(Key.AccountBy.name, name);
/* 62 */       if (acct != null) {
/* 63 */         Map<String, Object> attrs = new HashMap();
/* 64 */         if (!acct.isIsSystemResource()) {
/* 65 */           attrs.put("zimbraIsSystemResource", "TRUE");
/*    */         }
/* 67 */         if (!acct.isIsSystemAccount()) {
/* 68 */           attrs.put("zimbraIsSystemAccount", "TRUE");
/*    */         }
/* 70 */         modifyAttrs(acct, attrs);
/*    */       }
/*    */     }
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/account/ldap/upgrade/BUG_72007.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */